/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.zakariya.stickyheaders.model;


import org.zakariya.stickyheaders.ResourceTable;
import org.zakariya.stickyheaders.holder.HeaderHolder;

/**
 * HeaderModel
 *
 * @since 2021-08-20
 */
public class HeaderModel extends ItemModel {
    /**
     * HeaderModel类型
     */
    public static final int TYPE_70vp = 2;
    public static final int TYPE_45vp = 1;
    private String title;
    private String message;
    private int type;
    private int index;
    private int headSection;
    private boolean toggle = false;

    public boolean isToggle() {
        return toggle;
    }

    public void setToggle(boolean toggle) {
        this.toggle = toggle;
    }


    /**
     * HeaderModel
     *
     * @param title   title
     * @param message message
     * @param type    type
     * @param index   index
     */
    public HeaderModel(String title, String message, int type, int index, int headSection) {
        this.title = title;
        this.message = message;
        this.type = type;
        this.index = index;
        this.headSection = headSection;
    }

    @Override
    public boolean isHeader() {
        return true;
    }

    @Override
    public int getResource(int position) {
        if (type == TYPE_45vp) {
            return ResourceTable.Layout_item_header_45vp;
        }
        return ResourceTable.Layout_item_header;
    }

    @Override
    public Class getHolderClass(int position) {
        return HeaderHolder.class;
    }

    @Override
    public String getTitle() {
        return title;
    }

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public int getType() {
        return TYPE;
    }

    @Override
    public int getIndex() {
        return index;
    }

    @Override
    public int getHeadSection() {
        return headSection;
    }
}
